﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NGPT.ExportToGephi.ExportToGephiWebPart;
using System.IO;
using Microsoft.SharePoint;

namespace NGPT.ExportToGephi.Tests
{
    [TestClass]
    public class ExportToGephiTests
    {
        [TestMethod]
        public void ExportToGEXF()
        {
            
            MemoryStream ms = new MemoryStream();

            //get current service context
            string strUrl = "http://vyamaletdinov-n";
            SPSite site = new SPSite(strUrl);
            SPServiceContext serviceContext = SPServiceContext.GetContext(site);

            var exportService = new ExportService(serviceContext);

            exportService.ExportToGEXF(ms, "creator", "description", true, true, true, true);
            ms.Flush();
            ms.Seek(0, SeekOrigin.Begin);

            StreamReader sr = new StreamReader(ms);
            string xmlText = sr.ReadToEnd();

            Assert.AreNotEqual<long>(0, xmlText.Length);
        }
    }
}
